class SweetPotato(object):
    def __init__(self, state, cooked_time):
        self.state = state
        self.cooked_time = cooked_time

    def __str__(self):
        return f"地瓜状态为:{self.state},烧烤总时间为:{self.cooked_time}分钟"

    def cook(self, time):
        self.cooked_time += time
        if 0 <= time < 3:
            self.state = "生的"
        if 3 <= time < 6:
            self.state = "半生不熟"
        if 6 <= time < 8:
            self.state = "熟了"
        if 8 <= time:
            self.state = "烤糊了"


dg = SweetPotato("生的", 0)
dg.cook(6)
print(dg)
